#include<iostream>
#include<string.h>
#include"Socket.hpp"
int main()
{
    TcpSocket client;
    client.Build_Client_Socket(8888,"127.0.0.1");
    std::string msg = "Hello,world!";

    while(true){

        for(int i = 0; i < 3; i++){
            int n = client.Send(msg.c_str(),msg.size());
            if(n < 0){
                LOG_ERR("send error:%s",strerror(errno));
                continue;
            }
            char buf[1024];
            int m = client.Recv(buf,sizeof(buf)-1);
            if(m < 0){
                LOG_ERR("recv error:%s",strerror(errno));
                continue;
            }
            buf[m] = '\0';
            LOG_INF(" recv:%s",buf);    
            sleep(1);
        }
        
        sleep(10);
    }
    return 0;
}